1 <!doctype html>
2 <html>
3 <head>
4         <title>Petproducts </title>
5         <style>
6   body {
7   margin:
0;
8   font-family: Arial, Helvetica, sans-serif;
9   background: #
484848;
10 }
11 .topnav {
12   overflow: hidden;
13   background-color: #f44336;
14   height: 70px;
15   border: 3px solid #ff0000;
16 }
17
18 .topnav a {
19   
float: left;
20   color: #f2f2f2;
21   text-align: center;
22   padding: 14px 16px;
23   text-decoration: none;
24   font-size: 35px;
25   font-weight: bold;
26 }
27 </style>
28 <body>
29 <div
class="topnav">
30             <a
class="active" href="home.html"><img src="ic_add_pet.png"></a>
31             <a href=
"petproducts.php">pets products</a>
32            
33           </div>
34 <?php
35
36 $servername =
"localhost";
37 $username =
"root";
38 $password =
"";
39 $dbname =
"Petshop_management";
40
41 // Create connection

42 $conn =
new mysqli($servername, $username, $password, $dbname);
43 // Check connection

44 if
($conn->connect_error) {
45     die(
"Connection failed: " . $conn->connect_error);
46 }

47 //echo
" CONNECTION ESTABLISHED \r\n";
48 //echo
" INSERTION IN PROCESS";
49 $pp_id=$_POST[
"t1"];
50
51 $Query2=
"select count(*) from pet_products where pp_id='$pp_id'";
52 $Execute = mysqli_query($conn,$Query2);
53 $count = mysqli_fetch_row($Execute);

54
55 if
($count[0]==1)
56 {
57   $sql =
"DELETE FROM pet_products WHERE pp_id='$pp_id'";
58   
if ($conn->query($sql) == TRUE) {
59       echo
'<div>
60       <h1 style=
"color:#f2f2f2;font-size:50px; font-family: "Roboto", sans-serif;margin:auto;">Data deleted successfully</h1>
61          </div>
';
62   }
else {
63       echo
"Error: " . $sql . "<br>" . $conn->error;
64   }
65 }

66 else
{
67   echo
'<div>
68   <h1 style=
"color:#f2f2f2;font-size:40px; font-family: "Roboto", sans-serif;margin:auto;"> Data not found</h1>
69      </div>
';
70 }
71
72
73 $conn->close();
74 ?>
75 <form>
76         <button type=
"submit" style=" height: 50px;width: 150px;cursor:pointer;border-radius:15px;
77 border: 3px solid #ff0000;background-color:#f44336;color:#f2f2f2;font-size:17px;"
formaction="petproducts.php">back</button>
78 </form>
79 </body>
80 </html>


Gõ tìm kiếm nhanh...